<template>
	<view class="y_wrap">
			<u-form :model="form" ref="uForm" label-width="100px">
				<u-form-item label="姓名">
					<u-input v-model="form.name" />
				</u-form-item>
				<u-form-item label="身份证号"><u-input v-model="form.intro" /></u-form-item>
				<u-form-item label="手机号"><u-input v-model="form.sex"  /></u-form-item>
				<u-form-item label="省市区">
					<u-input placeholder="选择省市区" v-model="addr">
					</u-input>
				</u-form-item>
				  <u-picker keyName="name" :show="show" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeHandler"></u-picker>
					  
				<u-form-item label="详细地址">
					<u-input v-model="form.sex"  />
				</u-form-item>
				<u-form-item label="疫苗人群分类"><u-input v-model="form.sex"  /></u-form-item>
				<u-form-item>
					<u-button type="success" @click="toSure">确定预约</u-button>
				</u-form-item>
				
			</u-form>
	</view>
</template>

<script>
	import {getProvince,getCity} from '@/api/xinguan.js'
	import {sureYuyue} from '../../api/xinguan.js'
	export default {
		data() {
			return {
				region: ['广东省', '广州市', '海珠区'],
				customItem: '全部',
				form: {
					name: '',
					intro: '',
					sex: ''
				},
				show: false,
				columns: [
				
				]
			};
		},
		onLoad(option){
			console.log(option,"999999999999")
			this.getPro();
			
		},
		methods:{
			async toSure(){
				let res=await sureYuyue({
					name:"李俊丰",
					id_card:"232326199210014730",
					phone:"18600002762",
					address:"河北省 廊坊市 广阳区",
					address:"东方大学城",
					crowd_sort:"学生",
					date:"06-11",
					period:"上午时段",
					reserve_time:"8:00-12:00",
					when:0
				})
				console.log(res,"00000000023333")
			},
			async getPro(){
				let res=await getProvince();
				console.log(res)
				this.$set(this.columns,0, res)
				
			},
			async changeHandler(obj){
				console.log(obj)	
				
				if(obj.columnIndex==0){
					let res=await getCity(obj.value[0].id)
					console.log(res)
				   this.$set(this.columns,1, res)
				}
				if(obj.columnIndex==1){
					let res=await getCity(obj.value[1].id)
					console.log(res)
				   this.$set(this.columns,2, res)
				}
			},
			confirm(obj){
				console.log(obj,"---------------")
				this.addr=obj.value[0].name+obj.value[1].name+obj.value[2].name
				this.show=false;
				console.log(this.addr)
			}
			
		}
	};
</script>

<style lang="scss">
	.y_wrap{
		padding: 0 30px;
		box-sizing: border-box;
	}
</style>